package chaoyi.kuo.arrays

/**
 * @author ChaoYi, Kuo
 */
object GreetingArray {
  def main(args : Array[String]) : Unit = {
		  /*
		   * From a class blueprint,
		   * you can instantiate objects,
		   * or class instances, by using new.
		   */
		  val s = new String("ChaoYi, Kuo")
		  println(s)
		  
		  /*
		   * val
		   */
		  val greetStrings = new Array[String](3)
		  greetStrings(0) = "Hello"
		  greetStrings(1) = ", "
		  greetStrings(2) = "World!\n"
			  
		  for ( i <- 0 to 2)
			  print(greetStrings(i))
		  
		  greetStrings(2) = "ChaoYi!\n"
		  greetStrings.update(2, "Kuo!\n")
		  
		  for ( i <- 0.to(2))
			  print(greetStrings(i))
		 
		  for ( i <- greetStrings)
			 print(i)
  }
}
